﻿using Adnc.Infra.Mapper;
using Currency.IServices.Shared;
using Currency.IServices.Shared.Models;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;
using System.Net;

namespace Currency.Services.Shared.Extension
{
    public abstract class AbstractService : IService
    {
        public IObjectMapper Mapper { get; set; }

        protected ResultMessage ResultMessage()
            => new ResultMessage();

        protected ResultMessage<TValue> RstMessage<TValue>([NotNull] TValue value)
            => new ResultMessage<TValue>(value);

        protected ErrorDetails ErrorDetails(HttpStatusCode? statusCode = null, string detail = null, string title = null, string instance = null, string type = null)
            => new ErrorDetails(statusCode, detail, title, instance, type);

        protected Expression<Func<TEntity, object>>[] UpdatingProps<TEntity>(params Expression<Func<TEntity, object>>[] expressions)
            => expressions;
    }
}
